﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Arizu.Repository;
using System.Web.SessionState;

namespace AiRiZu.User.handler
{
    public class UpdateRoomPricePerNight : IHttpHandler, IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            if (context.Session["logId"] == null)
            {
                return;
            }

            AirizuRoom airizuRoom = AirizuRoom.CreateInstance();

            if (!string.IsNullOrEmpty(context.Request.Params["roomId"].ToString()) && !string.IsNullOrEmpty(context.Request.Params["pricePerNight"].ToString()))
            {
                airizuRoom.UpdateDayRent(long.Parse(context.Request.Params["roomId"].ToString()), int.Parse(context.Request.Params["pricePerNight"].ToString()));
            }
            
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
